-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Add callsite revalidation optout #14542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: 0715840 The changes in this PR will be included in the next version bump. This PR includes changesets to release 11 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
23aff25 to
3ee7f30
Compare
3ee7f30 to
62e3f8f
Compare
a015f8b to
8929118
Compare
8929118 to
9c211ae
Compare
|
General approach is looking good on a quick pass! A few minor comments - I'll do some deeper testing once those are updated |
d879db7 to
67ee043
Compare
|
Updated per your comments. good calls 👍 |
|
This is looking awesome! I made some very minor updates inside the router, and instead of testing locally with an app I just wrote a bunch of tests and they all passed so I think we're good on that front. I prefixed it with |
| let defaultShouldRevalidate: boolean; | ||
| if (typeof callSiteDefaultShouldRevalidate === "boolean") { | ||
| // Use call-site value verbatim if provided | ||
| defaultShouldRevalidate = callSiteDefaultShouldRevalidate; | ||
| } else if (shouldSkipRevalidation) { | ||
| defaultShouldRevalidate = false; | ||
| } else { | ||
| defaultShouldRevalidate = isRevalidationRequired; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the only functional change - we also need to apply this to any fetcher.load revalidation checks
|
I just kicked off an experimental release from this branch for some alpha testing: |
|
woohoo! Thanks for carrying it to the finish line @brophdawg11! |
|
Am I missing something or holding it wrong? wat.yafw.balanced.mp4 |
|
ooh good catch @brookslybrand. It's because you're actually exporting a Problem is here @brophdawg11. react-router/packages/react-router/lib/dom/ssr/routes.tsx Lines 607 to 613 in a947b03
The existence of this code and the comment makes me believe it might not be as simple as just deleting though. 🤔 |
This adds callsite revalidation optout as brought up here: #10006
If this new value evaluates to
false, it will skip calling the currently matched route'sshouldRevalidatefunctions entirely, superseding and short-circuiting them.